// let a = 100;
// let str = 'abc'
// let fn = function() {
//   console.log("fn函数")
// }

// module.exports = {
//   a,str,fn
// }

// const path = require('path')
// console.log(path.join('a','./','b','c'))
// console.log(path.join(__dirname,'./files','input.txt'))
// console.log(__filename)


const fs = require('fs');
const path = require('path');
// 读取文件
let filePath = path.join(__dirname,'files','2.txt')
// let filePath = './files/input.txt'
// fs.readFile(filePath,'utf-8', (err,data)=>{
//   if(err) throw err;
//   console.log(data)
// })
let str = `
床前明月光
疑是地上霜
举头望明月
低头思故乡
`
fs.writeFile(filePath,str,err=>{
  if(err) throw err;
  console.log('写入成功')
})